<template>
  <div>
    <div :span='24' v-for='(item, index) in positionAppliedList' :key='item.WORK_RECORD_ID'
         style='padding-left: 20px; margin: 5px;'>
      <el-card>

        <el-descriptions class='margin-top' :column='2'>
          <el-descriptions-item label='招聘岗位'>{{ item.TITLE }}</el-descriptions-item>
          <el-descriptions-item label='薪酬待遇'>{{ item.WAGES || '面议' }}</el-descriptions-item>
          <el-descriptions-item label='企业名称'>{{ item.COMPANY }}</el-descriptions-item>
          <el-descriptions-item label='学历要求'>{{ item.EDUCATION || '暂无' }}</el-descriptions-item>
          <el-descriptions-item label='经验要求'>{{ item.EXP || '暂无' }}</el-descriptions-item>
          <el-descriptions-item label='工作地址'>{{ item.HP_ADDRESS }}</el-descriptions-item>
          <el-descriptions-item label='投递状态'>
            <el-tag size='small'>
              {{
                item.STATUS == 0
                  ? '新申请' : item.STATUS == 1
                    ? '被查看'
                    : item.STATUS == 2
                      ? '待面试'
                      : item.STATUS == 3
                        ? '已录用' : '不合适'
              }}
            </el-tag>
          </el-descriptions-item>
        </el-descriptions>

        <div v-if='item.STATUS == 2 ? true : false'>
          <p style='font-size: 15px; color: #0183d2'>面试通知：{{item.NOTICE || '暂无' }}</p>
          <el-tag type='success'>面试时间：<span style='color: #d31010'>{{item.FACETIME || '以通知为准'}}</span></el-tag>
          <el-tag type='success'>面试地点：<span style='color: #d31010'>{{item.ADDRESS || '以通知为准'}}</span></el-tag>
          <el-tag type='success'>联系人：<span style='color: #d31010'>{{item.CONTACTPERSON || '暂无'}}</span></el-tag>
          <el-tag type='success'>联系电话：<span style='color: #d31010'>{{item.CONTACTPHONE || '暂无'}}</span></el-tag>
        </div>
      </el-card>
    </div>
    <!--分页条-->
    <el-pagination
      style='float: right'
      background
      @current-change='handleCurrentChange'
      :current-page='currentPage'
      :page-size='pageSize'
      layout='total,prev,pager,next'
      :total='totalNumber'>
    </el-pagination>
  </div>
</template>

<script>
import globalTitle from '../globalTitle.vue'
import { getPositionAppliedList } from '../../api/api'

export default {
  name: 'xueShuJiaoLiu',
  data() {
    return {
      positionAppliedList: [],
      currentPage: 1,
      pageSize: 10,
      totalNumber: 0,
      interviewStatus: 'none'
    }
  },
  created() {
    this.getPositionAppliedList()
  },
  methods: {
    // tableRowClassName({row, rowIndex}) {
    //   if (rowIndex === 1) {
    //     return 'warning-row';
    //   } else if (rowIndex === 3) {
    //     return 'success-row';
    //   }
    //   return '';
    // }

    //获取申请的简历列表
    getPositionAppliedList() {
      const data = {
        PAGE: this.currentPage,
        PAGESIZE: this.pageSize
      }
      getPositionAppliedList(data)
        .then(res => {
          console.log(res)
          if (res.code == 200) {
            this.positionAppliedList = res.data.DATA.list
            this.totalNumber = res.data.DATA.totalResult
            console.log('res.data.DATA.list', res.data.DATA.list)
          }
        })
        .catch(err => {
          console.log(err)
        })
    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.getPositionAppliedList()
    }
  }
}
</script>

<style>
.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}

</style>
